package com.demo.servicelmpl;

import com.demo.mapper.DailyActivityMapper;
import com.demo.mapper.LessonMapper;
import com.demo.mapper.ResultMapper;
import lombok.SneakyThrows;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author 李天航
 * 每天删除错误数据
 */
@Service
public class DeleteWrongData extends Thread {
    @Resource
    DailyActivityMapper dailyActivityMapper;
    @Resource
    LessonMapper lessonMapper;
    @Resource
    ResultMapper resultMapper;

    @SneakyThrows
    @Override
    public void run()
    {
        while(true) {
            dailyActivityMapper.deleteWrongData();
            lessonMapper.deleteWrongData();
            resultMapper.deleteWrongData();
            System.out.println("完成依次错误数据清理");
            Thread.sleep(24*60*60*1000);
        }
    }
}
